package com.vates.curso.dao.imp;

import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Repository;

import com.vates.curso.dao.DataAccessLayerException;
import com.vates.curso.dao.RoleDao;
import com.vates.curso.entities.Role;


@Repository("roleDao")
public class RoleDaoImp extends GenericDaoHibernate<Role, Long> implements
		RoleDao {

	public RoleDaoImp(Class<Role> role) {
		super(role);

	}

	
	public RoleDaoImp() {
		super(Role.class);

	}
	Log log = LogFactory.getLog(RoleDaoImp.class);

	/**
	 * Insert a new Role into the database.
	 * 
	 * @param role
	 */
	public Role save(Role role) throws DataAccessLayerException {
		return super.save(role);
	}

	/**
	 * Delete a detached Role from the database.
	 * 
	 * @param role
	 */
	public void remove(Role role) throws DataAccessLayerException {
		super.remove(role.getRoleId());
	}

	/**
	 * Updates the state of a detached Role.
	 * 
	 * @param role
	 */
	public void update(Role role) throws DataAccessLayerException {
		super.save(role);
	}

	/**
	 * Finds all Role in the database.
	 * 
	 * @return
	 */
	public List<Role> getAll() throws DataAccessLayerException {
		return super.getAll();
	}

	/**
	 * Finds all distinct Role in the database.
	 * 
	 * @return
	 */
	public List<Role> getAllDistinct() {

		return super.getAllDistinct();

	}

	/**
	 * Finds a Role in the database.
	 * 
	 * @return
	 */
	public Role get(long id) {
		return super.get(id);
	}

	/**
	 * Return true if a Role exist in the database.
	 * 
	 * @return
	 */
	public boolean exists(Long id) {
		return super.exists(id);
	}

	/**
	 * Return a list of Roles that exist in the database.
	 * 
	 * @return
	 */
	public List<Role> findByNamedQuery(String queryName,
			Map<String, Object> queryParams) {
		return super.findByNamedQuery(queryName, queryParams);
	}

}